<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing 	Session tocken
 *
 * @category   	PHP classes
 * @package    	Form
 * @copyright  	Copyright (c) 2007-2012 Professional World company(http://www.worldprovn.com/)
 *									   & Vietnam Zend Framework community (http://www.zend.vn/)
 * @author		DungDam (quangdungninh@worldprovn.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 08:00:00 PM Jan 29, 2013
 */
class Zendvn_Form_Tocken{
	
	static function tocken($url){
		$ssNameSpace = 'tk_' . md5($url . time());
		$ss = new Zend_Session_Namespace($ssNameSpace);
		$ss->$ssNameSpace = $ssNameSpace . time();
		$ss->setExpirationSeconds(1);
		$ss = $ss->getIterator();
		return $ssNameSpace;
	}
	static function checkTocken($tocken){
		$flag 		= false;
		$ss 		= new Zend_Session_Namespace($tocken);
		if(!empty($ss->$tocken)):
			$flag 	= true;
			$ss->unsetAll();
		endif;
		return $flag;
	}
}